<template>
  <div>
      <div class="projectDiv" v-for="(item,index) in projectLists" :key="index" @click="newDetailLink(item.id)">
          <div class="projectListImg fl" :style="imgWidth">
              <img :src="item.headImage">
          </div>
          <div class="projectCon fl" :style="projectConStyle">
              <div class="projectConBox">
                    <span class="projectTit fontSize36" :style="projectConBox">{{item.title}}</span>
                    <span class="fontSize18 projectZh">{{item.nickname ? item.nickname : '中新社'}}<font>{{item.comCount}}</font>跟帖</span>
              </div>
          </div>
      </div>
  </div>
</template>
<script>
import apiProject from '../../api/project'
export default {
  data(){
      return{
          pageNum:1,
          projectLists:[],
          imgWidth:{
            width:document.body.clientWidth/(750/240)+'px',
            height:document.body.clientWidth/(750/240)/(240/180)+'px',
            overflow: 'hidden'
          },
          projectConStyle:{
              paddingLeft:document.body.clientWidth/(750/30)+'px',
              height:((document.body.clientWidth/(750/240)/(240/180) - 1) - (document.body.clientWidth/(750/240)/(240/180) - 1)/(180/25)*2)+'px',
              width:document.body.clientWidth/(750/440)+'px',
              paddingTop:(document.body.clientWidth/(750/240)/(240/180) - 1)/(180/25)+'px',
              paddingBottom:(document.body.clientWidth/(750/240)/(240/180) - 1)/(180/25)+'px'
          },
          projectConBox:{
              height:(document.body.clientWidth/(750/240)/(240/180) - 1)/(180/42) * 2 +'px',
          }
      }
  },
  mounted(){
      this.projectList()
  },
  methods:{
      projectList(){
          let parms = {specialId:this.$route.params.projectId,pageSize:10,pageNum:this.pageNum} 
          apiProject.projectList(parms).then(data => {
              this.projectLists = data.body.data.list
          })
      },
      newDetailLink(id){
        this.$router.push({
            name:'newDetail', 
            params:{
                typeNew: '3',newId:id,userId:this.$route.params.userId
                }
            })
      }
  }
}
</script>
